package com.shou.types.exception;

import com.shou.types.common.ReturnCodeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * ClassName:DuplicateException
 * Project:SmartPark
 * Package: com.shou.types.exception
 * Description
 *
 * @Author Nemo
 * @Create 2025/2/17 22:16
 * @Version 1.0
 */
public class DuplicateException extends BusinessException{
    @Getter
    @AllArgsConstructor
    public enum ErrorCodeEnum {
        DUPLICATE_INPUT_USER_NAME("A-CLI-01-01", "用户名已存在！"),
        DUPLICATE_RESERVED_INPUT_USER_ID("A-CLI-01-03", "每个用户最多只能预定两个车位！"),
        DUPLICATE_INPUT_SPACE_CODE("C-CLI-01-01", "车位不可用！"),
        DUPLICATE_INPUT_CODE("A-CLI-01-02", "编号已存在！");

        private final String errorCode;
        private final String message;
    }
    public DuplicateException(DuplicateException.ErrorCodeEnum errorCodeEnum, ReturnCodeEnum httpStatus) {
        super(errorCodeEnum.getErrorCode(), errorCodeEnum.getMessage(), httpStatus);
    }
    public DuplicateException(DuplicateException.ErrorCodeEnum errorCodeEnum, String description, ReturnCodeEnum httpStatus) {
        super(errorCodeEnum.getErrorCode(), errorCodeEnum.getMessage() + description, httpStatus);
    }
}
